

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>systemd &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/doctools.js"></script>
        <script src="../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="inventory" href="../inventory/" />
    <link rel="prev" title="Overview" href="../intro/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../">ceph-volume</a></li>
      <li class="breadcrumb-item active">systemd</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../_sources/ceph-volume/systemd.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">ceph-volume</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../#id2">迁移</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../#id3">全新部署</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../#osd">已有 OSD 怎么办</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../intro/">Overview</a></li>
<li class="toctree-l4"><a class="reference internal" href="../intro/#replacing-ceph-disk">Replacing <code class="docutils literal notranslate"><span class="pre">ceph-disk</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../intro/#gpt-partitions-are-simple">GPT partitions are simple?</a></li>
<li class="toctree-l4"><a class="reference internal" href="../intro/#modularity">Modularity</a></li>
<li class="toctree-l4"><a class="reference internal" href="../intro/#ceph-volume-lvm"><code class="docutils literal notranslate"><span class="pre">ceph-volume</span> <span class="pre">lvm</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../intro/#lvm-performance-penalty">LVM performance penalty</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../inventory/"><code class="docutils literal notranslate"><span class="pre">inventory</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../drive-group/"><code class="docutils literal notranslate"><span class="pre">drive-group</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/"><code class="docutils literal notranslate"><span class="pre">lvm</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/activate/"><code class="docutils literal notranslate"><span class="pre">activate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/batch/"><code class="docutils literal notranslate"><span class="pre">batch</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/batch/#ceph-volume-lvm-batch-report">报表</a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/batch/#sizing">Sizing</a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/batch/#idempotency-and-disk-replacements">Idempotency and disk replacements</a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/encryption/">加密</a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/prepare/"><code class="docutils literal notranslate"><span class="pre">prepare</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/create/"><code class="docutils literal notranslate"><span class="pre">create</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/scan/">scan</a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/list/"><code class="docutils literal notranslate"><span class="pre">list</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/zap/"><code class="docutils literal notranslate"><span class="pre">zap</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/migrate/"><code class="docutils literal notranslate"><span class="pre">migrate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/newdb/"><code class="docutils literal notranslate"><span class="pre">new-db</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../lvm/newwal/"><code class="docutils literal notranslate"><span class="pre">new-wal</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../simple/"><code class="docutils literal notranslate"><span class="pre">simple</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../simple/activate/"><code class="docutils literal notranslate"><span class="pre">activate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../simple/scan/"><code class="docutils literal notranslate"><span class="pre">scan</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../simple/systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../zfs/"><code class="docutils literal notranslate"><span class="pre">zfs</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../zfs/inventory/"><code class="docutils literal notranslate"><span class="pre">inventory</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="systemd">
<span id="ceph-volume-systemd"></span><h1>systemd<a class="headerlink" href="#systemd" title="Permalink to this heading"></a></h1>
<p>As part of the activation process (either with <a class="reference internal" href="../lvm/activate/#ceph-volume-lvm-activate"><span class="std std-ref">activate</span></a>
or <a class="reference internal" href="../simple/activate/#ceph-volume-simple-activate"><span class="std std-ref">activate</span></a>), systemd units will get enabled that
will use the OSD id and uuid as part of their name. These units will be run
when the system boots, and will proceed to activate their corresponding
volumes via their sub-command implementation.</p>
<p>The API for activation is a bit loose, it only requires two parts: the
subcommand to use and any extra meta information separated by a dash. This
convention makes the units look like:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">volume</span><span class="o">@</span><span class="p">{</span><span class="n">command</span><span class="p">}</span><span class="o">-</span><span class="p">{</span><span class="n">extra</span> <span class="n">metadata</span><span class="p">}</span>
</pre></div>
</div>
<p>The <em>extra metadata</em> can be anything needed that the subcommand implementing
the processing might need. In the case of <a class="reference internal" href="../lvm/#ceph-volume-lvm"><span class="std std-ref">lvm</span></a> and
<a class="reference internal" href="../simple/#ceph-volume-simple"><span class="std std-ref">simple</span></a>, both look to consume the <a class="reference internal" href="../../glossary/#term-OSD-ID"><span class="xref std std-term">OSD id</span></a> and <a class="reference internal" href="../../glossary/#term-OSD-UUID"><span class="xref std std-term">OSD uuid</span></a>,
but this is not a hard requirement, it is just how the sub-commands are
implemented.</p>
<p>Both the command and extra metadata gets persisted by systemd as part of the
<em>“instance name”</em> of the unit.  For example an OSD with an ID of 0, for the
<code class="docutils literal notranslate"><span class="pre">lvm</span></code> sub-command would look like:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">systemctl</span> <span class="n">enable</span> <span class="n">ceph</span><span class="o">-</span><span class="n">volume</span><span class="nd">@lvm</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">0</span><span class="n">A3E1ED2</span><span class="o">-</span><span class="n">DA8A</span><span class="o">-</span><span class="mi">4</span><span class="n">F0E</span><span class="o">-</span><span class="n">AA95</span><span class="o">-</span><span class="mi">61</span><span class="n">DEC71768D6</span>
</pre></div>
</div>
<p>The enabled unit is a <a class="reference internal" href="../../glossary/#term-systemd-oneshot"><span class="xref std std-term">systemd oneshot</span></a> service, meant to start at boot
after the local filesystem is ready to be used.</p>
<section id="failure-and-retries">
<h2>Failure and Retries<a class="headerlink" href="#failure-and-retries" title="Permalink to this heading"></a></h2>
<p>It is common to have failures when a system is coming up online. The devices
are sometimes not fully available and this unpredictable behavior may cause an
OSD to not be ready to be used.</p>
<p>There are two configurable environment variables used to set the retry
behavior:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">CEPH_VOLUME_SYSTEMD_TRIES</span></code>: Defaults to 30</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CEPH_VOLUME_SYSTEMD_INTERVAL</span></code>: Defaults to 5</p></li>
</ul>
<p>The <em>“tries”</em> is a number that sets the maximum amount of times the unit will
attempt to activate an OSD before giving up.</p>
<p>The <em>“interval”</em> is a value in seconds that determines the waiting time before
initiating another try at activating the OSD.</p>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../intro/" class="btn btn-neutral float-left" title="Overview" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../inventory/" class="btn btn-neutral float-right" title="inventory" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>